<template>
  <a-modal title="查看图片" style="top: 20px;" :width="1048" :visible="visible" @cancel="visible=false" :footer="null">
    <div style="text-align:left;margin-bottom:8px">
      <a-button style="margin-top: 10px;" type="danger" @click="print">打印</a-button>
    </div>
    <div id="print">
      <div style="max-width:1000px;max-height:1000px;">
        <img style="max-width:1000px;max-height:1000px" :src="printUrl" />
      </div>
    </div>
  </a-modal>
</template>

<script>
export default {
  components: {},
  props: {
    // printUrl: {
    //   type: String,
    //   required: true,
    //   default: ''
    // }
  },
  data() {
    return {
      visible: false,
      printUrl: '',
    }
  },
  watch: {},
  computed: {},
  methods: {
    view(data) {
      Object.assign(this, { visible: true, printUrl: data })
    },
    print() {
      var wind = window.open('', 'newwindow', 'height=700, width=1000, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
      wind.document.body.innerHTML = document.getElementById('print').innerHTML
      wind.print()
    },
  },
  created() {},
  mounted() {},
}
</script>
<style lang="less" scoped>
</style>